package com.zygh.policeasset.utils;

import java.math.BigDecimal;

/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/utils/Arith.class */
public class Arith {
    public static double add(double value1, double value2, int scale) {
        return new BigDecimal(Double.valueOf(value1).toString()).add(new BigDecimal(Double.valueOf(value2).toString())).setScale(scale, 6).doubleValue();
    }

    public static double sub(double value1, double value2, int scale) {
        return new BigDecimal(Double.valueOf(value1).toString()).subtract(new BigDecimal(Double.valueOf(value2).toString())).setScale(scale, 6).doubleValue();
    }

    public static double mul(double value1, double value2, int scale) {
        return new BigDecimal(Double.valueOf(value1).toString()).multiply(new BigDecimal(Double.valueOf(value2).toString())).setScale(scale, 6).doubleValue();
    }

    public static double div(double value1, double value2, int scale) throws IllegalAccessException {
        if (scale >= 0) {
            return new BigDecimal(Double.valueOf(value1).toString()).divide(new BigDecimal(Double.valueOf(value2).toString()), scale, 6).doubleValue();
        }
        throw new IllegalAccessException("精确度不能小于0");
    }

    public static boolean isNumeric(String str) {
        int i = str.length();
        do {
            i--;
            if (i < 0) {
                return true;
            }
        } while (Character.isDigit(str.charAt(i)));
        return false;
    }
}